<template>
  <!-- 统计图表 -->
  <div ref="myChart" id="myChart" style="height:300px"></div>

</template>
<script>
import * as echarts from 'echarts'
export default {
  components: {},
  props: {
    datas: {
      type: Array,
      default: () => { }
    },
    obj: {
      type: Object,
      default: () => { }
    }
  },
  data() {
    return {
      myChart: null
    };
  },
  computed: {},
  watch: {
    datas: {
      handler() {
        this.init();
      },
      deep: true
    }
  },
  mounted() {
    const that = this;
    that.init();
    window.onresize = () => {
      that.myChart.resize();
    }

  },
  methods: {
    init() {
      const option = {
        radar: {
          // 设置雷达图的中心位置
          center:['50%','60%'],
          radius:'70%',
          // 雷达图的指示器（维度）
          indicator: [
            { name: '东部', max: 10 },
            { name: '西部', max: 10 },
            { name: '南部', max: 10 },
            { name: '北部', max: 10 },
            { name: '中部', max: 10 }
          ],
        },
        series: [{
          type: 'radar',
          data: [{
            value: [5, 8, 6, 9, 7], // 对应东部、西部、南部、北部、中部的值，需根据实际调整
            name: '数据系列'
          }]
        }]
      };
      if (!this.myChart) {
        this.myChart = echarts.init(this.$refs.myChart);
      }
      // 绘制图表
      this.myChart.setOption(option)
    }

  }
};
</script>
<style lang="sess" scoped>
</style>